Ten&#39;s complement circuit



`eliminating the need for subtract circuits.

TENS coMPLEMENr CIRCUIT Jacob Goldberg, Bonnar Cox, and William H. Kautz,

Palo Alto, and Milton B. Adams, Sunnyvale, Calif., assignors, by mesne assignments, to General Electric Company, New York, N.Y., a corporation of New York Application December 24, 1956, Serial No. 630,145

3 Claims. (Cl. 23S-159) This invention relates to information-handling machines and, more particularly, to an improved arrangement for providing the tens complement of numbers.

' In the course of their operation, present-day electronic information-handling machines, or data-processing machines, have occasion to handle negative numbers. In order to render these numbers very distinctive, especially on printout from the machine, it is desirable to convert them to their tens complement. By the tens complement of a number is meant the difference between a number and ten raised to a power equal to the number of digits in said number. By way of example, the tens complement of 7 is 3, of'398 is 602. By extending the power of one digit, the tens complementwill Ialways be preceded by a nine and thus be easily identified. Thus in the above examples, the tens complements are'93 and 9602. A Tens complementing also permits subtraction by addition, thus In order to obtain the tens complement of a number, it has heretofore been the practice to perform the operation of subtraction. Although this operation is not difficult, the circuitry required is rather expensive, since arithmetic units employed in information-handling machines are rather complex. Time-sharing of the arithmetic unit which is usuallypresent in the information-handling machine may b'e employed so that when it is not being used for other strictly mathematical operations it can be used for tens complementing accrued negative numbers. This is not too desirable an arrangement, since it requires programming a storage system of some type and then switching apparatus when time is available. However, along with the eX- tensive apparatus required in this type of an arrangement, the tying up of the arithmetic unit holds up allother operations having need of it. y

An object of the presentl invention is to provide a novel arrangement for tens ,complementing numbers.

V,Another object of the present arrangement is to provide an inexpensive circuit arrangement for tens complementing numbers. y I

` Yet another object of the present invention is the provision of the unique and simple method and means for deriving the tens complement of a number.

These and other objects of the present invention are achieved by an arrangement which takes advantage of a unique property of numbers which is evidenced when the tens complement of these numbers is sought to be taken.` Considering the tens complement of a number digit by digit, the least-signiticant digit of the resultant tens complement is the true tens complement. All the other digits are actually the nines complement of the original number. This is the case except where there are zeros present in the least-significant-digit positions of the original number. The lirst digit to the left of any zeros Patented Jan. 12, 1960 ice extending from and including the least-signicant-digit position of a number will be the true tens complement.

The next digit to the left of that one and the others thereafter will be the nines complements of the original number.

In order to illustrate what has been stated more clearly, let us examine, for example, the number 0152. Its tens complement is 9848. The digit 8 is a true tens complement of 2, but the digits 4 and 8 are the nines complements of the digits 5 and l in the original number. Next considerthe number 0520. The tens complement of this number is 9480. The tens complement of the zero is zero. The tens complement of the 2 is 8, but the digit 4 is the nines complement of the number 5 in the original number. Consider now the number 03070. Its tens complement is 96930. As pointed out above, the 7 and 0 in the original number have as their tens complement respectively 3 and 0, butthe 3 and 0 in the original number in the tens complement resultant are respectively a 6 and 9. In the. present invention, numbers are fed into the tens-complementing circuit serially, least-significant digit v rst. The circuit contains both a tens complementer and a nines complementer. The circuit contains a Switching arrangement and the least-signiiicant digit will pass through the tens complementer, which produces as its output the complement of that digit with respect to ten. The circuitry then switches to the nines complementer,

so that the remaining digits will pass through the nines complementer, producing as an output the nines complements of the remaining digits. A zero-sensing circuit is provided, which prevents the switching from the tens to the nines complementing circuits as long as zeros are continually sensed in the lesser significant digit positions. When zeros are no longer sensed, then the switching circuit is enabled to operate in the manner previously described. The novel features that are considered characteristic of this invention are set forth with particularity in the appended claims. The invention itself, both as to its organization and method of operation, as Well as additional objects and advantages thereof, will best be understood from the following description when read in connection with the accompanying drawings, in which:

Figure 1 is a block diagram illustrating the principles of this invention; and

Figure 2 is a block diagram of an embodiment of this invention used to tens complement excess-three binarycoded decimal numbers.

Reference is now made to Figure 1, which is a block diagram illustrating the principles of the invention. This block diagram can be used for any number system in which numbers are represented in digital fashion electrically. For the purposes of explanation, let it be assumed that a binary decimal numbering system is employed, wherein each digit of a decimal number s represented in binary code. This requires that for each digit position of the decimal number there will be four binary digit positions. This is necessary in order that the numbers zero through nine be represented in binary fashion. Thus, for ease in explanation, four binary digits are called a digitreferring to the digit represented in decimal codeeach binary digit is called a bit, or binary digit.

A serial-number source 10 provides as its output in series the binary number signals representing the decimal number which is to be tens complemented. These signals are emitted synchronized by pulses from a synchronizing pulse source 12. This is the usual source of clock pulses which is provided in an information-handling machine, either by a stable oscillator or by pulses recorded on a drum which are read continuously by some other suitable means. The technique of using synchronizing pulses, Yor clock pulses, as they are more commonly known, for timing the operation of electrical equipment is well known infthe eld. Y 1

T-he first one of the digits emitted from the serial-number source 1t) passes through the normallyy closed contacts 113 of a 'relay 114 to Vatens complement circuit 16. The output of this tens complement circuit is the tens coniplement of the rst decimal digit which is represented by four'binary digits. The tens vcomplement is applied to an OR Vgate 18, or buffer, from whence it is suppliedV toA the remainder of the system 'in which it is utilized.

The output from the sync pulse source 12 is also applied toa counter 20. This counter ladvances after each decimaldigit in thenumber. Here the number of digits is three. At thistime, lthe counter output is applied through" an YORgate 27 and to an AND gate 24. Also appliedrtof plied to reset a flip-flop circuit 22. This flip-flop circuit, when in its set condition, energizes the relay 14. When it is reset, the relay is deenergized.

The output from the serial-number source is also applied towhat may be called a nonzero senser cir` cuit 2'65 This is merely v'circuitry which recognizes that the code does not represent a zero and provides an output indicative of that fact.` The output of the nonzero senseiv is applied to AND ygate 24 at the same time an output isY received `from the OR gate 27. The output of AND gate A 214-, sets the l'lip-Ho'p'22 and energizes Vthe relay 14.v This This representation is used to enable a simple discussion of the various bit positions to be made without undue complexity. Studying the W and X bit positions, it will be seen that when a one occurs, in either the W or the X bit position, the number'being` represented by the excessthree code is not a zero. Thus, all that is necessary to sense zero is to sense that in the W or X bit positions there is not a one. Another point to note in the :excessthree code is that the tens, complement of zero is zero.

Now referring to Figure 2, which shows a block diagram of an embodiment of the invention Yas applied to the excess-three code, a parallel-data source 30 provides,

an output consisting of successivey sets of four binary bits the OR gate 27 are counter outputs for each digit of thek s number. The output of the counter when it is filled is ap? causes :the vrelay contacts 13 to connect the output of the sierialinumberv ,source toa nines complementer circuit 28.' Aslonga's a zero occurs, commencingwith the least-sigf` niiicant digit of `a number, the outputof the arrangement of the invention, the Adescription that follows is that of a` circuit which was built and operated satisfactorily. inthe particular system in which the circuit was operated, theV excess-three' code was employed. As is well known, this excess-three code is a binary code in which zero is repre-r sentedby three, or 0011 in regular binary code. One is represented by four, orOlOO, in regular binary code, etc.

' Y Thenumbersfrom zero to nine in eXcess-threercode are represented below:

Excess-three Nlnes Com- Tens Coml plcment plement Y Decimal Binary W X Y Z W X Y Z W X Y Z O 0 0 0 0 0 1 1 1 l 0 0 0 0 l 1 O V0` 0 1 0 1 '0 0 1 0 l 1 1 1 0 0- 0 0 1 0V 0 1 0 1 1 0 l 0 1 0 1 1` 0 0 1 1 0 1 l 0 1 0 0 l 1 0 1 0 0 1 l) 0 0 l l 1 l 0 0 0 l 0 0 1 0 1 0 1 l 0 0 0 0 1 1 V1 1 0 0 0 0 1 1 0 1V 0 0 1 0 1 l 0 0 1 1 1V 0 1 1 1 1 O 1 0 0 1 0 1 0 l 1 O- 1 0- 0 0 1 0 1 1 O 1 0 0 0 1 0 1 1 0 0 1 1 1 0 0 0 0 1 1 0 l O O The advantage of using the excess-three code is that by replacing ones with zeros and zeros with ones, the nines complement of an excess-three code number is achieved.

yIt should be noted that in the table shown above the letters W, X, Y, and Z are respectively applied to the ,bitl positions in order of significance, most signincant bitrst.

Each four binary bits are applied to four ip-flopfcircuits, respectively designated at 32W, 32X, 32Y, and 32Z,V

to correspond to the foulbits in the excess-three code.

A synchronizing pulse source 34 provides the clock pulsesV Y to the parallel data source and alsoV provides pulses to the counter 36. Thiscounter is Ya four-bit ring counter, being returned to zero afterY it hasY counted the' fourth pulse.

A` numberfrom the parallel-data sourcewill set or resetY theA flip-ops 32W through 32Z, depending on whether a zero or one ris applied to the respective flip-Hops. The

counter, in response to outputfrom the synchronizingY f pulsesource, goes through its sequence-of counts sequentially 4applying outputs to the respective AND gates 38W y throughSSZ. In'this manner, these AND gates'serializeI the data which is staticized inthe flip-flop circuits 32W throughl 32,2, since an output is or is not received from i the AND gatesl depending on whether the associatedflip-0 flop circuituwas or was not set as a result of a one or ay zerpor signalhaving beenY applied'frorn'the parallel data source,V Thev 'outputs from the'AND gatesA `are applied f When'counter 364 iswreset to its zero condition, a pulse isl applied ,toV quizorenable4 two. -AND gates. 42W and.

42X. (These respectively` are connected tofthe-one, or`V both of the W andXrpositions of a number. No outits'zero, or reset, side.

putsrarerreceivedfrom these AND gates42X and 42W- Y when the W andrvX positions are zero, indicating that'theVV number isa zero. The output of these AND gates is applied to.` an VOR gate 44, and the output therefrom,

. designated as thek not zero output, is applied to an 'ams pliiier 46.

The output of theORvgate 40 is applied to a. cathode follower 48'. The output of the cathodefollower, whichv consists ofthe data which has beenserialized, is also y applied "to an inverter 50. The output ofthe inverter 50 Y consists of serialized data in complementary form. EX-Y pressed another way, the inverter may be an amplifier or a trigger circuit which phase inverts the data so that when a zero signal is applied to the inverter input the output of nal is applied to the inverter input,`ts output corresponds to, a zero.l The output of the amplifier 46, or not-zero output, is applied through a new number AND gatev 47to two AND gates 52, 54, which have as their sec-l ond inputs'pulses from the clock pulse source. The out-l puts fromthese AND gates are 'applied to set twoipflops 56, 58. Flip-flop 56 enablesANDV gate 47 from Thus AND gate 47 remains enabled as long as llip-llop 5K6 remains reset. Flip-flops 56 and 58 remain reset as long as there are zeros. The zero, or reset, output of flip-nop 56 isv also applied to an AND gate 60; the one, or set, output of iiip-op 56 is applied tortwo AND gates 62, 64. The zero output of flip-opSS is applied to AND gate 64; the one output of hip-flopl 58.is applied to AND gate 62.

Let us consider .now what happens when data is applied to the system. First', the Hip-ops 32W through 32Z assumeset or,reset conditions corresponding to the ones Y and zeros of the number being applied thereto. An out- 58 when in its one condition and a clock input.

put is received fromA either AND gate 42W or 42X, or lboth, depending upon whether there are ones or not in jthe W and X bit positions of the number. Assume that there were ones in either or both positions.` This will cause dip-flops 56 and 58 to be set. As counter 36 lserializes the data which is staticized in the flip-hops 132W through 32Z, the data output of the cathode follower 48 is applied to AND gates 60 and 62. The output of the inverter 50 is applied to AND gate 64. It rshould also be noted that the output of the cathode follower 48 is also applied to an AND gate 66, which has as its other required inputs an output from the tiip-op The output of this AND gate 66 is connected to reset the flip- .op 58. Flip-flop 58 will be reset by the first binary -one appearing in the data. However, this one bit will pass through AND gate 62 before flip-flop 58 will be Preset by it. Thus, either a zero or a one in the first binary bit position is enabled to pass through AND gate `-62 to an OR gate 68 which provides its output to sub- '.sequent utilization apparatus. AND gate 64 is enabled `when flip-op-iiop 58 is reset, since it is connected to receive the output of the zero side of dip-flop S8. Ihere- :fore, after the first one bit, the only output from OR gate 68 is the complement of input data. As previousily shown in the excess-three code, this is the nines comgalement.

By way of a specific example to better illustrate the bperation of the apparatus, consider that the first num- :ber being applied is the number four in excess-three code. This is 0111. Its tens complement is six, or 1001. A one digit is sensed in the X position, and therefore both flip-flops 56 and 58 are set. The least-significant binary digit is received first from the staticizing flip-flops 32W through 32Z. Thus, a one will be passed through AND gate 62 and OR gate 68. As described previously, succeeding binary digits in the output of OR gate 68 will be complements, since flip-op 58 is'reset, AND gate 62 is disenabled, and AND gate 64 is enabled. Thus, the Y digit of four is a zero. The X digit is a zero, and the W digit will be a one. The output of OR gate 68 is therefore 1001. This is the tens complement of four.

Assume now that the next number appearing is the number eight, or 1011, for example. Since the first number has been sensed as not being zero, AND gate 47 is disenabled. There should now be provided as output from OR gate 68 the nines complement of the number eight, which is one, or 0100. Since AND gate 64 remains enabled by the zero output of flip-flop 58, the number at the output of OR gate 68 will be the output of inverter 50, or the nines complement of the input. Flip-Hops 56, 58 are resetV by a reset input only after the total number which is desired to be complemented has been processed. This can be done by a reset signal which may be received from a counter as shown in Figure 1. This signal is applied to two OR gates S7 and 59, which are coupled to the reset input sides of the flip-flops 56 and'58.

If the first binary digit number to be processed is zero, then the iiip-ops 56 and 58 are not set, but remain in their reset condition. Under these circumstances, AND gate 60 is enabled from the zero output of flip-flop 56. Therefore, the data corresponding to the number zero in excess-three code can pass directly through AND gate 60 to OR gate 68. This can continue until a number is received which is not a zero; then the operation that occurs is identical to what has been described above.

The flip-flop circuits, AND gates, OR gates, and counters employed in the embodiment of the invention constitute well-known circuitry. Illustrations of circuitry which is suitable is found, for example, described and shown in the text Electronics, by Elmore and Sands, published by the McGraw-Hill Book Company in 1949. Gates, for example, are shown in pages 117-123; flip-flops and inverters are shown on pages 10S-109.

.Accordingly, there has been described and shown hereinabove a novel, useful, and simple arrangement for obtaining the tens complement of a number.

We claim:

1. A circuit for providing the tens complement of a number represented by electrical signals derived from a source, said number having one Aor more digits each being expressed in excess-three binary'code, the electrical signals from said source representative of the digits and the binary bits of each digit being received serially, leastsignificant digit and bit first, said circuit comprising an input terminal to which said binary bit signals are applied, an inverter for generating signals representing the complement of the bits applied to said input terminal, a first and a second flip-dop circuit, each having a first and a second stable state and respectively having first and second outputs indicative thereof, an output terminal, first gate means to apply input from said input terminal to said output terminal responsive to a first output from said first flip-flop, second gate means to apply input from said input terminal to said output terminal responsive to second outputs from said first and second liip-ops, third gate means to apply output from said inverter to said output terminal responsive to second output from said first flip-flop and first output from said second ip-op, means for driving said first and second flip-flops to their second stable states responsive to an incoming digit as represented by its signals not being a zero including means for enabling such operation only once for all signals representative of a number, and means for driving said second tiip-op to its first stable state responsive to the first one binary bit signal of said incoming digit at said input terminal.

2. A circuit for providing the tens complement of a number represented by electrical signals derived from a source, said number having one or more digits each being expressed in excess-three binary code, the electrical signals from said source representative of the digits and the binary bits of each digit being received serially, leastsignificant digit and bit first, said circuit comprising an input terminal to which signals representative of said binary bits are applied, an inverter for generating signals representative of the complement of the signals representative of the bits applied to said input terminal, a first and a second flip-flop circuit, each having a first and a second stable state and respectively having first and second outputs indicative thereof, first, second and third coincidence gates each requiring a simultaneous presence of its inputs to provide an output, an output terminal to which all said 'coincidence-gate outputs are coupled, said first coincidence gate having its inputs respectively coupled to said first flip-flop first output and to said input terminal, said second coincidence gate having its inputs respectively coupled to said first and second flip-flop second outputs and said input terminal, said third coincidence gate having its inputs respectively coupled to said first flip-flop second output, said second flip-op first output and to the output of said inverter, means for driving said first and second ip-fiops to their second stable states responsive to an incoming digit as represented by its signals not being a zero, including means for enabling such operation only once for signals representative of a number, and means for driving said second flip-flop to its first stable state responsive to the first one binary bit signal of said incoming signals representative of a digit at said input terminal.

3. A circuit as recited in claim 2 wherein said means for driving said first and second ip-tiops to their second stable states responsive to an incoming digit as represented'by its/signals not being a zero includes means to provide a nonzero output signal responsive to the presence of a one binary bit signal in the third or fourth leastsignificant positions of a digit, and said means for enabling such operation only once for a number includes a fourth coincidence gate having its output coupled to said farsanip-nopfr-drivin@tb-ifsrsecond condition amines,` M Y`OTHER REFERENCES,

nonzero output ah ftofftlie first youtput of 's'aid-yspi'p- ContrLEngineeng" APH-1 1956; APage895 311597 re op g @f Y v Y .Vl` ie`d,c`jr1i. A 'j Ref'relces Cited in the le of this patent 1 5 UNITED 'STATES vPATENTS V2,799,450 Iohnson July 16, 1957 

